/**
 * @param {string} s
 * @return {string}
 */
 var removeDuplicates = function(s) {
    let stack = [s[0]]
    let i = 1;
    while(i<s.length){
        if(i>0&&stack[stack.length-1]==s[i]){
            stack.pop()
            i++
            continue
        }
        stack.push(s[i])
        i++
    }
    return stack.join("")
};